Add -mstrict-align to the gcc options
authorJuan Castillo <[email protected]>
Fri, 6 Nov 2015 12:43:56 +0000 (12:43 +0000)
committerJuan Castillo <[email protected]>
Tue, 10 Nov 2015 09:17:08 +0000 (09:17 +0000)
ARMv8 architecture allows unaligned memory accesses. However,
Trusted Firmware disables such feature by setting the SCTLR_A_BIT
and SCTLR_SA_BIT in the SCTLR_EL3 register (it enables alignment
checks).

This patch adds -mstrict-align to the gcc build options. Although
there are not explicit unaligned memory accesses in Trusted Firmware,
this flag will tell the compiler not to use them.

Fixes ARM-software/tf-issues#294

Change-Id: I69748c6cf28504be9ca3dc975a331d14459c9ef1

Makefile

index ac059e825151e91cb717377578600e6bc79e82fb..e683d77bf8cf9bd819005c29f03f52493289634e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -167,7 +167,8 @@ ASFLAGS                     +=      -nostdinc -ffreestanding -Wa,--fatal-warnings   \
                                ${DEFINES} ${INCLUDES}
 CFLAGS                 +=      -nostdinc -ffreestanding -Wall                  \
                                -Werror -Wmissing-include-dirs                  \
-                               -mgeneral-regs-only -std=c99 -c -Os             \
+                               -mgeneral-regs-only -mstrict-align              \
+                               -std=c99 -c -Os                                 \
                                ${DEFINES} ${INCLUDES}
 CFLAGS                 +=      -ffunction-sections -fdata-sections